package com.yxy.controller.admin;

import com.yxy.common.Result;
import com.yxy.constant.RequestMapperConstant;
import com.yxy.service.VisitService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.math3.util.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("adminHomeController")
@RequestMapping(RequestMapperConstant.ADMIN_REQUEST_MAPPER + "home")
@Slf4j
public class HomeController {

    @Autowired
    private VisitService visitService;

    /**
     * 获取系统登陆量数据
     * @return
     */
    @GetMapping("/getStatistics")
    public Result<Pair<List<String>, List<Integer>>> getStatistics() {
        log.info("获取系统登陆量数据");
        return Result.success("", visitService.getSystemVisitData());
    }
}
